package com.zyb.warehouse.mapper;

import com.zyb.warehouse.entity.UserRole;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

/**
 * Description:用户角色持久层
 */
@Mapper
public interface UserRoleMapper {

    /**
     * 根据用户ID删除用户角色关系
     *
     * @param userId
     * @return
     */
    @Delete("delete from user_role where user_id=#{userId}")
    Integer deleteUserRoleByUserId(Integer userId);

    /**
     * 删除之后重新添加用户角色
     *
     * @param userRole
     * @return
     */
    @Insert("insert into user_role values(null,#{roleId},#{userId})")
    Integer insertUserRole(UserRole userRole);
}
